Why Python is my Favorite Language
Merry Hannukah! I've been trying very hard not to think about anything tech related this week, but also want to keep to a weekly schedule of newsletters. Can't let y'all down! To not let you down and also not have to think about tech, I'm sharing a first draft on learning new languages. It gets a pass because I wrote it two months ago. Enjoy!
(Yes, I'll change the title for the final draft.)
Why Python Is My Favorite Language
I want to do $THING. Normally I do my hacking in Python, which is alright, but has lots of frustrations. My friends tell me Yarlsnarth is better for doing $THING. After going through the online tutorial, I can see why. Maybe I'll try Yarlsnarth for this project! Just a few things I need to figure out first:
- How am I supposed to be writing this? Do I download an IDE? Is there a Vim plugin? Is this ostensibly editor-agnostic but really supposed to use Emacs?
- Uh oh, there's two competing plugins. Which do I choose?
- How do I read from a file? How do I parse JSON? How do I pull environmental variables?
- Basically, how do I do any of the things that aren't part of the core syntax/semantics but are super common problems people face every day?
- I'm going to have to memorize another 100 functions and their parameters, aren't I?
- What are the language quirks that will cost me an hour to discover?
- What are the footguns that will cost me a day to debug?
- What are the little things that normally aren't a problem but will trip me up every time I switch back to a different language? Things like "how to slice a list" or "how to import a module".
- How is the help organized? Is there an official site? How's the site laid out?
- Is it actually useful or will it make me stop computers?
- Is it one of those weird ones where it's aimed at complete newbies or masters, and nothing in between?
- Can I download the official docs, or will I have to be online to read any of the references?
- I hit problem X. Will I find help in the official docs, or the faq, or the community, or should I be putting random stuff into Google?
- Oh, looks like someone answered this in 2007! Which was eight versions ago. Are they still right or is their advice obsolete?
- I found something from 2011 that said the 2007 person was wrong. So I know the language is changing enough that I can't trust older advice. But I can't find anything more recent. Do I do what 2011 dude says?
- How do I debug? Will doing anything other than "break into repl" be like pulling teeth?
- Will "break into repl" be like pulling teeth?
- What are all the magic commands in the repl?
- Testing. Is unit testing part of the core library, or do I need to install a third party framework?
- Or both? Like how Python comes with
unittest
, but everybody usespytest
. - What about property-based testing? Does Yarlsnarth even have a PBT library?
- How does the test runner work? How long should I try to integrate it with my dev environment before giving up and running it in a separate terminal?
- Or both? Like how Python comes with
- How do I build? How do I package? How do I manage my environment?
- Package management.
- How do I find the packages I need? If there are multiple competing packages, how do I decide which one I should use?
- And now I have to learn the APIs of the third-party packages.
- And the API of the package manager itself.
- What are the "canonical" packages the community has consensus on? Am I going to have to dive into the community to find out what I need to install?
- I do?
- Oh god.
- So... the language community.
- Where are they? Will I have to join Yet Another Slack? Install Yet Another Messaging App?
- Are they friendly to beginners, hostile, passive-aggressive?
- Are there any missing stairs or known abusers? Are there high-profile rivalries?
- What innocuous-seeming topics always turn into a flamewar? Is my question even safe to ask?
- Now they're explaining something waaaay above my head. Is this necessary to get, or are they just knowledge-blind?
- What are all these in-jokes supposed to be?
Screw this, I'm going back to Python.
Solving this
[[Things are much more rough-drafty past this point]]
Most of my problems with learning a language fall in two categories:
- How to use a particular algorithm API
- How to do something supporting my program, like test, build, import modules, etc.
It's not about how mind-bending the language paradigm is, or how it's architectured. I just getg frustrated relearning how to do specific things that I already know how to do, where I have to spend a lot of time searching how this language does it. Kind of like accidental vs essential complexity.
What I need is an "X for Y", but better. Something like To Ruby from Python or Go for Python Programmers only cover the core. They don't cover the peripheral libraries or the lagangue ecosystem. Hyperpolyglot is better, but doesn't talk much about the ecosystem. It also doesn't compare across language families, which could be very helpful here.
Beyond that, I'd also need a beginners overview of the ecosystem. If you look at the Python docs, it recommends you use pytest for testing and requests for HTTP calls. That should all be in one place.
Another thing that's helpful: boilerplate starter apps. Something where all of the libraries are already integrated for you and you can modify them to figure stuff out. The downside is it's less clear what's part of the core language and what's an addon, so those should be clearly marked.
All of these require a lot of non-technical work from the community, something that's scarce for most open-source projects.
[some kind of finish]
If you're reading this on the web, you can subscribe here. Updates are once a week. My main website is here.
My new book, Logic for Programmers, is now in early access! Get it here.